<?php
class PublicAction extends Action {
	/**
	 * [login description]
	 * @return [type] [description]
	 */
	public function login($username = null, $password = null) {

		if(IS_POST) {
			import('PassportService');
			$PassportService = new PassportServiceAction();
			$uid = $PassportService->login($username , $password);
			if($uid > 0) {
				$this->success('登录成功!',U('Admin/Index/index'));
			}else{
				switch ($uid) {
					case -1:$error  = '用户不存在或被禁用！'; break; //系统级别禁用
					case -2:$error  = '密码错误！'; break;
					default: $error = '未知错误！'; break; // 0-接口参数错误（调试阶段使用）
				}
				$this->error($error);
			}
		}else{
			$this->display();
		}
		
	}
}